Skip to content

Better TypeScript support for CellMetadata#255

Merged
texodus merged 1 commit intomasterfrom
better-ts
Feb 4, 2026
Merged

Better TypeScript support for CellMetadata#255
texodus merged 1 commit intomasterfrom
better-ts

Conversation

@texodus
Copy link
Member

@texodus texodus commented Feb 4, 2026

This PR elaborates on TypeScript types exported by regular-table in a number of useful ways (and fixes some random debris):

  • Introduces discriminated union type for CellMetadata to provide precise type information based on cell type (row_header, column_header, corner, body).
  • Adds a type discriminant field to all cell metadata, enabling TypeScript narrowing and better IDE autocomplete.
  • Adds global TypeScript declarations for the custom element (JSX intrinsics, document.createElement, document.querySelector).
  • Split CellMetadata into specific types: CellMetadataRowHeader, CellMetadataColumnHeader, CellMetadataCorner, and CellMetadataBody.
  • Added internal CellMetadataBuilder type for partial metadata during cell construction
  • Added FPSRecord type for getDrawFPS() return value, getMeta() ro turen CellMetadata.
  • Fixed getMeta() to correctly use table_model.header._fetch_cell for column header lookups (was incorrectly using body._fetch_cell).
  • Removed unused _reset_viewport(), _reset_scroll(), and clearWidthStyles() methods.

@texodus texodus added the enhancement Feature requests or improvements label Feb 4, 2026
@texodus texodus marked this pull request as ready for review February 4, 2026 04:11
@texodus texodus merged commit f826d5b into master Feb 4, 2026
2 checks passed
@texodus texodus deleted the better-ts branch February 4, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature requests or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant